package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1791 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int findCenter(int[][] edges) {
            if (edges[0][0] == edges[1][0]) return edges[0][0];
            if (edges[0][1] == edges[1][0]) return edges[0][1];

            if (edges[0][0] == edges[1][1]) return edges[0][0];
            return edges[0][1];
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.findCenter(InputUtil.toDoubleIntegerArray("[[1,2],[2,3],[4,2]]")));
        System.out.println(solution.findCenter(InputUtil.toDoubleIntegerArray("[[1,2],[5,1],[1,3],[1,4]]")));
    }

    public static void main(String[] args) throws Exception {
        LC1791 an = new LC1791();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
